package com.tamtamy.jtta.data;

/**
 * Handles the response to URI calls for  
 * <a href="https://tamtamy.reply.it/wiki/API#Contents_list">Content List</a> 
 *  
 * @see ArrayList 
 * @author Omar "0m4r" Adobati 
 * @version %I%, %G% 
 * 
 */
import java.util.ArrayList;
import java.util.Date;

import org.apache.commons.lang.builder.ToStringBuilder;

public class Content extends ArrayList<String> {	

	private static final long serialVersionUID = -1001038203619933138L;

	protected long id;
	protected String title;
	protected String url;
	protected String description;
	protected String permission;
	protected String discussionPermission;
	protected Date creationDate;
	protected Date updateDate;
	protected String userID;
	protected String favouriteCounter;
	protected String highlight;
	protected String numberOfComments;
	protected String rateEnabled;
	protected ArrayList<String> tags;
	protected String rate;
	protected String ratesNumber;	
	protected String languageCode;
	protected ArrayList<String> commentList;
	protected String views;
	protected String downloads;	
	protected String network;
	protected String descriptionPlainText;
	protected String permalink;

	public Content() {
		this.id = 0;
		this.title = null;
		this.url = null;
		this.description = null;
		this.permission = null;
		this.discussionPermission = null;
		this.creationDate = null;
		this.updateDate = null;
		this.userID = null;
		this.favouriteCounter = null;
		this.highlight = null;
		this.numberOfComments = null;
		this.rateEnabled = null;
		this.tags = null;
		this.rate = null;
		this.ratesNumber = null;
		this.languageCode = null;
		this.commentList = null;
		this.views = null;
		this.downloads = null;
		this.network = null;
	}	
		
	public Content(long id, String title, String url, String description,
			String permission, String discussionPermission,
			Date creationDate, Date updateDate, String userID,
			String favouriteCounter, String highlight, String numberOfComments,
			String rateEnabled, ArrayList<String> tags, String rate,
			String ratesNumber, String languageCode,
			ArrayList<String> commentList, String views, String downloads,
			String network) {
		this.id = id;
		this.title = title;
		this.url = url;
		this.description = description;
		this.permission = permission;
		this.discussionPermission = discussionPermission;
		this.creationDate = creationDate;
		this.updateDate = updateDate;
		this.userID = userID;
		this.favouriteCounter = favouriteCounter;
		this.highlight = highlight;
		this.numberOfComments = numberOfComments;
		this.rateEnabled = rateEnabled;
		this.tags = tags;
		this.rate = rate;
		this.ratesNumber = ratesNumber;
		this.languageCode = languageCode;
		this.commentList = commentList;
		this.views = views;
		this.downloads = downloads;
		this.network = network;
	}	
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getPermission() {
		return permission;
	}

	public void setPermission(String permission) {
		this.permission = permission;
	}

	public String getDiscussionPermission() {
		return discussionPermission;
	}

	public void setDiscussionPermission(String discussionPermission) {
		this.discussionPermission = discussionPermission;
	}

	public Date getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	public String getUserID() {
		return userID;
	}

	public void setUserID(String userID) {
		this.userID = userID;
	}

	public String getFavouriteCounter() {
		return favouriteCounter;
	}

	public void setFavouriteCounter(String favouriteCounter) {
		this.favouriteCounter = favouriteCounter;
	}

	public String getHighlight() {
		return highlight;
	}

	public void setHighlight(String highlight) {
		this.highlight = highlight;
	}

	public String getNumberOfComments() {
		return numberOfComments;
	}

	public void setNumberOfComments(String numberOfComments) {
		this.numberOfComments = numberOfComments;
	}

	public String getRateEnabled() {
		return rateEnabled;
	}

	public void setRateEnabled(String rateEnabled) {
		this.rateEnabled = rateEnabled;
	}

	public ArrayList<String> getTags() {
		return tags;
	}

	public void setTags(ArrayList<String> tags) {
		this.tags = tags;
	}

	public String getRate() {
		return rate;
	}

	public void setRate(String rate) {
		this.rate = rate;
	}

	public String getRatesNumber() {
		return ratesNumber;
	}

	public void setRatesNumber(String ratesNumber) {
		this.ratesNumber = ratesNumber;
	}

	public String getLanguageCode() {
		return languageCode;
	}

	public void setLanguageCode(String languageCode) {
		this.languageCode = languageCode;
	}

	public ArrayList<String> getCommentList() {
		return commentList;
	}

	public void setCommentList(ArrayList<String> commentList) {
		this.commentList = commentList;
	}

	public String getViews() {
		return views;
	}

	public void setViews(String views) {
		this.views = views;
	}

	public String getDownloads() {
		return downloads;
	}

	public void setDownloads(String downloads) {
		this.downloads = downloads;
	}

	public String getNetwork() {
		return network;
	}

	public void setNetwork(String network) {
		this.network = network;
	}

	public static ArrayList<String> getFilters(){
		return ContentFilter.getFilters();
	}
	
	public static ArrayList<String> getOrders(){
		return ContentOrder.getOrders();
	}
	
	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getDescriptionPlainText() {
		return descriptionPlainText;
	}

	public void setDescriptionPlainText(String descriptionPlainText) {
		this.descriptionPlainText = descriptionPlainText;
	}

	public String getPermalink() {
		return permalink;
	}

	public void setPermalink(String permalink) {
		this.permalink = permalink;
	}

	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
	
}

class ContentFilter{
	static final private String NONE = null;
	static final private String LINK = "link";
	static final private String DOCUMENT = "document";
	static final private String VIDEO = "video";
	static final private String AUDIO = "audio";
	static final private String UWA = "uwa";
	static final private String MESSAGE = "message";
	static final private String QUESTION = "question";
	
	public static ArrayList<String> getFilters(){
		ArrayList<String> filters = new ArrayList<String>();
		filters.add(NONE);
		filters.add(LINK);
		filters.add(DOCUMENT);
		filters.add(VIDEO);
		filters.add(AUDIO);
		filters.add(UWA);
		filters.add(MESSAGE);
		filters.add(QUESTION);
		return filters;
	}

}

class ContentOrder{
	static final private String NONE = null;
	static final private String LAST = "last";
	static final private String MOST_RATED = "most.rated";
	static final private String MOST_VIEWED = "most.viwed";
	static final private String MOST_FAVOURITED = "most.favourited";
	static final private String HOTTEST = "hottest"; 
	
	public static ArrayList<String> getOrders(){
		ArrayList<String> orders = new ArrayList<String>();
		orders.add(NONE);
		orders.add(LAST);
		orders.add(MOST_RATED);
		orders.add(MOST_VIEWED);
		orders.add(MOST_FAVOURITED);
		orders.add(HOTTEST);
		return orders;
	}

}
